package com.example.basic.web.enums;

/**
 * 停用启用标识
 */
public enum YesNoEnum {
    NO_FLAG("0", "否"),
    YES_FLAG("1", "是");

    // 类型
    private final String type;
    // 描述
    private final String desc;

    YesNoEnum(final String type, final String desc) {
        this.type = type;
        this.desc = desc;
    }

    /**
     * 获取资源类型
     */
    public static YesNoEnum getEnableTypeEnum(String type) {
        YesNoEnum[] ts = YesNoEnum.values();
        for (YesNoEnum t : ts) {
            if (t.getType().equalsIgnoreCase(type)) {
                return t;
            }
        }
        return NO_FLAG;
    }

    public String getType() {
        return type;
    }

    public String getDesc() {
        return desc;
    }
}